import React, { Component } from 'react';
import {CSSTransition} from 'react-transition-group';

class CssAni extends Component {
  constructor (props) {
    super(props);
    this.state = {
      show: false
    };
  }
  render() {
    return (
      <div>
        <button onClick={() => {this.setState({show: !this.state.show})}}>star</button>
        <CSSTransition
          in={this.state.show}
          timeout={1000}
          classNames="star"
          unmountOnExit
        >
          <div className="star">
            ⭐
          </div>
        </CSSTransition>
      </div>
    );
  }

}

export default CssAni;
